#include <iostream>

using namespace std;

// g++ new.cpp -o new.exe -std=c++11
int main(){
	
	int *ia = new int(9);
	// 没有初始化 只可能是任意的
	int *ib = new int;
	//*ib = 12;
	// C++11支持的 {}初始化方式, 只写{} 会初始化为0
	int *ic = new int{23};
	// 在堆内存中创建数组，同样可以用{} 初始化
	int *arr = new int[3]{7,2};
	
	cout<< "ia = " << *ia <<endl;
	cout<< "ib = " << *ib <<endl;
	cout<< "ic = " << *ic <<endl;
	cout<< "arr = " << *arr << " "<< arr[1] << " " << arr[2] <<endl;
	
	// 回收内存
	delete ia;
	delete ib;
	delete ic;
	delete[] arr;
	
	int a=10;
	int *b = new int{0};
	
	cout<< "ia = " << *ia <<endl;
	cout<< "ib = " << *ib <<endl;
	cout<< "ic = " << *ic <<endl;
	cout<< "arr = " << *arr << " " << arr[1] << "" << arr[2] <<endl;
}